package com.houger.ddd.seckill.constant;

import java.util.Arrays;

public enum InstanceStatusEnum {

    NONE( 0, "无"),
    OPENING( 1, "开启中"),
    ISSUING( 2, "奖励发放中"),
    FINISH( 3, "执行完毕"),
    CLOSE( 4, "关闭"),
    TIME_OUT( 5, "奖励领取超时"),
    UNDERSTOCK( 6, "库存不足，执行失败"),
    ;

    private int value;
    private String desc;

    InstanceStatusEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static InstanceStatusEnum getEnumByValue(int value) {
        return Arrays.stream(InstanceStatusEnum.values()).filter(a -> a.value == value).findFirst().orElse(null);
    }

}
